package com.homework.homework5;

import java.util.ArrayList;
import java.util.Iterator;

public class Test {
    public static void main(String[] args) {
        ArrayList<Person> objects = new ArrayList<>();
        objects.add(new Person("张三",20,1.80));
        objects.add(new Person("张三",22,1.58));
        objects.add(new Person("张三",23,1.69));
        objects.add(new Person("张三",24,1.70));

        Iterator<Person> iterator = objects.iterator();
        while (iterator.hasNext()){
            Person person=iterator.next();
            person.setAge(person.getAge()+2);
        }
        for (Person object : objects) {
            System.out.println(object.toString());
        }

    }
}
